home *** CD-ROM | disk | FTP | other *** search
/ Pesquisa Dirigida / Pesquisa Dirigida.iso / JOGOS / buscandoanemo.swf / scripts / frame_28 / DoAction.as
Text File  |  2005-01-17  |  3KB  |  136 lines

  1. function turtleRight()
  2. {
  3.    if(turtleLeanAngle < turtleAngleMax - turtleAngleMove)
  4.    {
  5.       turtleLeanAngle += turtleAngleMove;
  6.    }
  7.    else
  8.    {
  9.       turtleLeanAngle = turtleAngleMax;
  10.    }
  11. }
  12. function turtleLeft()
  13. {
  14.    if(- turtleAngleMax + turtleAngleMove < turtleLeanAngle)
  15.    {
  16.       turtleLeanAngle -= turtleAngleMove;
  17.    }
  18.    else
  19.    {
  20.       turtleLeanAngle = - turtleAngleMax;
  21.    }
  22. }
  23. function turtleUp()
  24. {
  25.    if(- turtleVYMax + turtleVYMove < turtleVY)
  26.    {
  27.       turtleVY -= turtleVYMove;
  28.    }
  29.    else
  30.    {
  31.       turtleVY = - turtleVYMax;
  32.    }
  33. }
  34. function turtleDown()
  35. {
  36.    if(turtleVY < turtleVYMax - turtleVYMove)
  37.    {
  38.       turtleVY += turtleVYMove;
  39.    }
  40.    else
  41.    {
  42.       turtleVY = turtleVYMax;
  43.    }
  44. }
  45. function createObsticle()
  46. {
  47.    duplicateMovieClip("masterObsticle","obsticle" add dupeCounter,16384 + (dupeCounter + 100));
  48.    dupeCounter++;
  49.    if(dupeCounterMax < dupeCounter)
  50.    {
  51.       dupeCounter = 0;
  52.    }
  53. }
  54. function createPowerup()
  55. {
  56.    duplicateMovieClip("masterPowerup","powerup" add dupeCounter,16384 + (dupeCounter + 100));
  57.    dupeCounter++;
  58.    if(dupeCounterMax < dupeCounter)
  59.    {
  60.       dupeCounter = 0;
  61.    }
  62. }
  63. function obsticleHitTurtle(whichObsticle)
  64. {
  65.    if(turtleFlashing == 0 and gameOn == 1)
  66.    {
  67.       trace(whichObsticle add " hit turtle");
  68.       turtle.gotoAndPlay("flash");
  69.       sounds.gotoAndPlay("badObsticle");
  70.       scoreLocal -= scoreRemovedObsticle;
  71.       if(scoreLocal < 0)
  72.       {
  73.          scoreLocal = 0;
  74.       }
  75.    }
  76. }
  77. function powerupHitTurtle(whichPowerup)
  78. {
  79.    if(gameOn == 1)
  80.    {
  81.       if(Math.random() < 0.5)
  82.       {
  83.          sounds.gotoAndPlay("goodObsticle1");
  84.       }
  85.       else
  86.       {
  87.          sounds.gotoAndPlay("goodObsticle2");
  88.       }
  89.       babyTurtlesCaught++;
  90.       scoreLocal += scorePowerup;
  91.    }
  92. }
  93. function turtleDied()
  94. {
  95.    gameOn = 0;
  96.    sounds.gotoAndPlay("gnarly");
  97.    turtle.anim.stop();
  98.    path.stop();
  99.    if(distanceToTunnelForceConv >= dttfcStop)
  100.    {
  101.       if(_level10.getBytesLoaded() >= _level10.getBytesTotal() and 30 < _level10.getBytesTotal())
  102.       {
  103.          _level10.gotoAndPlay("playVideo");
  104.       }
  105.       screens.gotoAndStop("gameOver3");
  106.    }
  107.    else if(distanceToTunnelForceConv >= dttfcCutoff2)
  108.    {
  109.       screens.gotoAndStop("gameOver2");
  110.    }
  111.    else
  112.    {
  113.       screens.gotoAndStop("gameOver1");
  114.    }
  115. }
  116. function turtleFellOut()
  117. {
  118.    trace("turtle fell out");
  119.    gameOn = 0;
  120.    turtleFallOff = 1;
  121.    turtleFallOffVX = -1 + Math.ceil((turtle._x - centerX) / 100000) * 2;
  122.    turtleFallOffVY = -1 + Math.ceil((turtle._y - centerY) / 100000) * 2;
  123.    trace("_x=" add turtle._x add " _y=" add turtle._y add " vx=" add turtleFallOffVX add " vy=" add turtleFallOffVY);
  124.    turtle.anim.stop();
  125.    path.stop();
  126.    turtleDied();
  127. }
  128. function restartCleanUp()
  129. {
  130.    stopAllSounds();
  131.    removeMovieClip("turtle");
  132.    removeMovieClip("screens");
  133.    removeMovieClip("scoreboard");
  134.    gotoIntro = 1;
  135. }
  136.